import 'package:app/common/colors.dart';
import 'package:app/common/tool.dart';
import 'package:app/components/base_scaffold_appbar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'my_calendar_detail_controller.dart';

class MyCalendarDetailView extends GetView{


  MyCalendarDetailController controller = Get.put(MyCalendarDetailController());
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: BaseAppBar(
        preferredSize: Size(Get.width, AppTool.appBarHEIGHT),
        child: const Text('日程详情'),
      ),
      body:GetBuilder<MyCalendarDetailController>(builder: (_){
        return  ListView(
          padding: EdgeInsets.all(15),
          children: [
            Container(
              height: 40,
              alignment: Alignment.centerLeft,
              child: Text('日程名称：${controller.model?.data?.name}'),
              // color: Colors.white,
            ),
            Divider(),
            Container(
              height: 40,
              alignment: Alignment.centerLeft,
              child: Text('开始时间：${controller.model?.data?.startTime}'),
            ),
            Divider(),

            Container(
              height: 40,
              alignment: Alignment.centerLeft,
              child: Text('结束时间：${controller.model?.data?.endTime}'),
            ),
            Divider(),
            Container(
              height: 40,
              alignment: Alignment.centerLeft,
              child:  Text('是否整天：${controller.model?.data?.allDay==true?'是':'否'}'),
            ),
            Divider(),

            Container(
              alignment: Alignment.centerLeft,
              height: 40,
              child:controller.model?.data?.duration==0?Text('持续时间：全天'):
              Text('持续时间：${controller.model?.data?.duration}分钟'),
            ),
            Divider(),

            Container(
                alignment: Alignment.centerLeft,
                height: 40,
                child: Text('公开程度：${controller.model?.data?.privacy}')),
            Divider(),

            Container(
                alignment: Alignment.centerLeft,
                height: 40,
                child: Text('描述：${controller.model?.data?.description??'暂无'}')),
            Divider(),

            Container(
                alignment: Alignment.centerLeft,
                height: 40,
                child: Text('位置：${controller.model?.data?.location}')),
            Divider(),

            Container(
                alignment: Alignment.centerLeft,
                height: 40,
                child: Text('参与人名：${controller.model?.data?.userNames?.join(',')}')),
            Divider(),

            Container(
                alignment: Alignment.centerLeft,
                height: 40,
                child: Text('分享人名：${controller.model?.data?.shareUserNames?.join(',')}')),
            Divider(),


            Container(
              width: 100,
              // color: Colors.yellow,
              child:Align(
                alignment: Alignment.centerLeft,
                child: MaterialButton(onPressed: (){
                  // controller.requestDataWithState('完成');
                  controller.requestDataWithUnlink();
                },child: Text('删除',style: TextStyle(color: Colors.white),),color: Colors.redAccent,),
              ),
            )
          ],
        );
      }),
    );
  }

}